package io.renren.modules.hospital.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import io.renren.modules.hospital.entity.HzEntity;
import io.renren.modules.hospital.service.HzService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 *
 *
 * @author starry
 * @email 2495646304@qq.com
 * @date 2023-11-15 15:54:22
 */
@RestController
@RequestMapping("hospital/hz")
@Api(value = "患者接口", tags = "患者接口")
public class HzController {
    @Autowired
    private HzService hzService;

    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation("列表")
    //@RequiresPermissions("hospital:hz:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = hzService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{hzId}")
    @ApiOperation("根据id获取信息")
    //@RequiresPermissions("hospital:hz:info")
    public R info(@PathVariable("hzId") Integer hzId){
		HzEntity hz = hzService.getById(hzId);

        return R.ok().put("hz", hz);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation("保存")
    //@RequiresPermissions("hospital:hz:save")
    public R save(@RequestBody HzEntity hz){
		hzService.save(hz);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperation("修改")
    //@RequiresPermissions("hospital:hz:update")
    public R update(@RequestBody HzEntity hz){
		hzService.updateById(hz);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    @ApiOperation("删除")
    //@RequiresPermissions("hospital:hz:delete")
    public R delete(@RequestBody Integer[] hzIds){
		hzService.removeByIds(Arrays.asList(hzIds));

        return R.ok();
    }

}
